package cn.funnyxb.powerremember.uis.wordbases.localImport;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.ProgressDialog;
import android.database.Cursor;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Toast;
import cn.funnyxb.powerremember.db.AllTableHolders;
import cn.funnyxb.powerremember.db.tables.Tbholder_wordsbaseinfo;
import cn.funnyxb.tools.appFrame.App;
import cn.funnyxb.tools.appFrame.activityFrame.ActivitysHolder;
import com.mobclick.android.MobclickAgent;
import java.io.File;

public class LocalImportWordBaseActivity extends Activity
  implements IUI_LocalImport
{
  private View.OnClickListener btnOnclickListener = new 1(this);
  private final String importFile = "power_remember.txt";
  private IProccessor_LocalImport proccessor;
  ProgressDialog progressDialog;

  private String getFullFileName()
  {
    return Environment.getExternalStorageDirectory() + File.separator + "power_remember.txt";
  }

  private void importWords(String paramString)
  {
    if (!(isFileExist()))
      new AlertDialog.Builder(this).setTitle(2131034130).setMessage("power_remember.txt" + getString(2131034225)).setNegativeButton(2131034133, null).create().show();
    while (true)
    {
      return;
      if ((paramString == null) || (paramString.length() < 1))
        new AlertDialog.Builder(this).setTitle(2131034130).setMessage(2131034224).setNegativeButton(2131034133, null).create().show();
      if (!(paramString.matches("\\w+")))
        new AlertDialog.Builder(this).setTitle(2131034130).setMessage(2131034223).setNegativeButton(2131034133, null).create().show();
      if (isBaseNameExist(paramString))
        new AlertDialog.Builder(this).setTitle(2131034130).setMessage(2131034222).setNegativeButton(2131034133, null).create().show();
      this.proccessor.asyncImportData(getFullFileName(), paramString);
    }
  }

  private void initFrame()
  {
    setTitle(getTitle() + "-->" + getString(2131034205));
    findViewById(2131165363).setBackgroundResource(17301654);
    findViewById(2131165360).setOnClickListener(this.btnOnclickListener);
    findViewById(2131165361).setOnClickListener(this.btnOnclickListener);
  }

  private boolean isBaseNameExist(String paramString)
  {
    Cursor localCursor = App.getApp().getAllTableHolders().getTbholder_wordbaseinfo().queryBaseName(paramString);
    int j;
    if (localCursor == null)
    {
      j = 0;
      label21: return j;
    }
    if (localCursor.getCount() > 0);
    for (int i = 1; ; i = 0)
    {
      localCursor.close();
      j = i;
      break label21:
    }
  }

  private boolean isFileExist()
  {
    File localFile = new File(getFullFileName());
    if ((localFile.exists()) && (localFile.isFile()));
    for (int i = 1; ; i = 0)
      return i;
  }

  private void showWaittingDialog()
  {
    this.progressDialog = new ProgressDialog(this);
    this.progressDialog.setTitle(2131034131);
    this.progressDialog.setMessage(getString(2131034142));
    this.progressDialog.setCancelable(false);
    this.progressDialog.setButton(getString(2131034136), new 2(this));
    this.progressDialog.show();
  }

  public void notifyCanceledImport()
  {
    if ((isFinishing()) || (isRestricted()));
    while (true)
    {
      return;
      if ((this.progressDialog != null) && (this.progressDialog.isShowing()))
        this.progressDialog.dismiss();
      this.progressDialog = null;
      Toast.makeText(this, 2131034145, 1).show();
    }
  }

  public void notifyFileNotfound()
  {
    if ((isFinishing()) || (isRestricted()));
    while (true)
    {
      return;
      if (this.progressDialog != null)
        this.progressDialog.dismiss();
      Toast.makeText(this, 2131034144, 1).show();
    }
  }

  public void notifyHasImport(int paramInt)
  {
    if ((isFinishing()) || (isRestricted()));
    while (true)
    {
      return;
      if (this.progressDialog == null)
        continue;
      this.progressDialog.setMessage(getString(2131034212) + paramInt);
    }
  }

  public void notifyIOException()
  {
    if ((isFinishing()) || (isRestricted()));
    while (true)
    {
      return;
      if (this.progressDialog != null)
        this.progressDialog.dismiss();
      Toast.makeText(this, 2131034143, 1).show();
    }
  }

  public void notifyImportCompleted(Integer paramInteger)
  {
    if ((isFinishing()) || (isRestricted()));
    while (true)
    {
      return;
      if (this.progressDialog != null)
        this.progressDialog.dismiss();
      Toast.makeText(this, 2131034146, 1).show();
    }
  }

  public void notifyWaitingImport()
  {
    if ((isFinishing()) || (isRestricted()));
    while (true)
    {
      return;
      showWaittingDialog();
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    this.proccessor = new Proccessor_LocalImport(this);
    setContentView(2130903059);
    getWindow().setSoftInputMode(3);
    initFrame();
  }

  protected void onDestroy()
  {
    this.proccessor.destroy();
    super.onDestroy();
  }

  protected void onPause()
  {
    super.onPause();
    MobclickAgent.onPause(this);
  }

  protected void onResume()
  {
    super.onResume();
    MobclickAgent.onResume(this);
    App.getApp().getActivitysHolder().regCurrentActivity(this);
  }

  protected void onStart()
  {
    super.onStart();
  }
}

/* Location:           E:\Desktop\复件 classes_dex2jar.jar
 * Qualified Name:     cn.funnyxb.powerremember.uis.wordbases.localImport.LocalImportWordBaseActivity
 * JD-Core Version:    0.5.3
 */